﻿using System.Reflection;
using System.Web.Http.Controllers;
using Ninject;
using Ninject.Parameters;
using Spotted.WebApi.Controllers;
using Spotted.WebApi.Core;

namespace Spotted.WebApi.Tests
{
    public class TestBase
    {
        protected IKernel GetKernel()
        {
            return new StandardKernel(
                       new WebApiNinjectModule(Assembly.GetAssembly(typeof (SpotController))),
                       new MoqNinjectModule());
        }

        protected T GetFromKernel<T>(string metaName) where T : class, IHttpController
        {
            var kernel = GetKernel();
            return kernel.Get<IHttpController>(metaName, new IParameter[0]) as T;
        }
    }
}
